﻿
namespace AiMoWindows.Windows.SaveCode
{
    class ShareSaveResult
    {
        public bool OK { get; set; } = false;
        public string Description { get; set; }
        public string Author { get; set; }
        public string CodeName { get; set; }
        public string SavePath { get; set; }
        public string ShareKey { get; set; } = "";

        readonly int m_InitAuthorDescriptionHash = 0;
        public bool ChangedAuthorAndDescription => HashStrings(Author, Description) != m_InitAuthorDescriptionHash;
        public ShareSaveResult(string savePath, string author, string description, string codeName, string shareKey)
        {
            SavePath = savePath;
            Author = author;
            Description = description;
            CodeName = codeName.Trim();
            ShareKey = shareKey;
            m_InitAuthorDescriptionHash = HashStrings(Author, Description);
        }

        int HashStrings(string author, string description)
        {
            return (author + description).GetHashCode();
        }

    }
}
